<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="ssm" uri="http://ssm.elangzhi.com/jsp/tag/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%--
Created by GaoXiang
Date: 2018-10-15 13:52:05 星期一
Version: 1.0
手持机信息编辑页面
--%>

<div class="portlet light" >
    <div class="portlet-body form">
        <!-- BEGIN FORM-->
        <form action="#" class="form-horizontal" id="edit-module">
            <div class="form-body">

                <div class="row">
                    <div class="col-md-6 hide">
                        <div class="form-group">
                            <label class="control-label col-md-3">ID</label>
                            <div class="col-md-9">
                                <input type="text" class="form-control" name="id" value="${data.id}" placeholder="默认生成，ID">
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-3">停车场</label>
                            <div class="col-md-9">
                                <input type="hidden" name="parkName" id="parkName" value="${parkName}">
                                <select  class="form-control" required id="parkId" name="parkId" onchange="chooseParkName()">
                                    <option value="${data.parkId}" hidden>${data.parkName}</option>
                                    <c:forEach items="${parkList.list}" var="park">
                                        <option value="${park.id}">${park.name}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-3">手持机编号</label>
                            <div class="col-md-9">
                                <input type="text" class="form-control" required name="posCode" value="${data.posCode}" >
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6 hide">
                        <div class="form-group">
                            <label class="control-label col-md-3">手持机状态</label>
                            <div class="col-md-9">
                                <input type="text" class="form-control" required name="posStatus" value="${data.posStatus}" placeholder="posStatus">
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-3">序列号</label>
                            <div class="col-md-9">
                                <input type="text" class="form-control" required name="posNumber" value="${data.posNumber}" placeholder="posNumber">
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6 hide">
                        <div class="form-group">
                            <label class="control-label col-md-3">锁定状态</label>
                            <div class="col-md-9">
                                <input type="text" class="form-control" required name="lockStatus" value="${data.lockStatus}" placeholder="lockStatus">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <div class="row">
                    <div class="col-md-6">
                        <div class="row">
                            <div class="col-md-offset-3 col-md-9">
                                <button type="button" class="btn green" onclick="edit();">修改手持机信息</button>
                                <button type="button" class="btn default" onclick="layer.close(layer_editModule);">取消</button>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6"> </div>
                </div>
            </div>
        </form>
        <!-- END FORM-->
    </div>
</div>
<!-- script 开始 -->
<script>

    $(function(){
        //初始化页面
        initPage();
    });

    /**
     * 保存编辑的手持机信息
     */
    function edit(){
        var param = tools.formParams("edit-module");
        if(tools.valid("edit-module")){
            tools.post("/handheld/update",param,function(data){
                if(data.success){
                    layer.msg('手持机信息修改成功', {icon: 1,time:1000},function(){
                        //刷新列表页面
                        toPage(null);
                        //关闭弹窗
                        layer.close(layer_editModule);
                    });
                }else{
                    tools.errorTip(data.code,data.message);
                }
            });
        }
    }
    function chooseParkName() {
        var name=$("#parkId option:selected").text();
        $("#parkName").val(name)
    }
</script>
<!-- script 结束 -->